export const INCREMENT_COUNTER = 'INCREMENT_COUNTER'
export const DECREMENT_COUNTER = 'DECREMENT_COUNTER'
export const FETCH_COUNTER = 'FETCH_COUNTER'

import * as API from './../api'

export function increment() {
    console.log('increment');
    return {
        type: INCREMENT_COUNTER
    }
}

export function decrement() {
    console.log('decrement');
    return {
        type: DECREMENT_COUNTER
    }
}

export function addNum(num) {
    console.log('getNum');
    return {
        type: FETCH_COUNTER,
        num: num
    }
}

export function getNum() {
    return (dispatch, getState) => {
        return API.test({
            data: {},
            success: function(result) {
                dispatch(addNum(result))
            },
            complete: function() {

            }
        })
    }
}